home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 API Bible / Windows 95 API Bible 3 Disc Set.iso / Win32 API Bible Book 1 of 3.iso / chapte25 / ex12.c < prev    next >
C/C++ Source or Header  |  1995-04-23  |  2KB  |  39 lines

  1. #include <genstub.c>
  2.  
  3. // Windows message procedure.
  4. LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
  5. {
  6.     switch ( uMsg )
  7.     {
  8.          case WM_COMMAND: /* process menu items */
  9.              switch ( LOWORD( wParam )  )
  10.              {
  11.                  case IDM_TEST: {
  12.                      TCHAR szBuffer[128];
  13.                      HDC hDC = GetDC( hWnd );
  14.                      // Pause five seconds to fill queue.
  15.                      TextOut( hDC, 0, 0, szBuffer, wsprintf(szBuffer, "%s", "DO INPUT NOW" ));
  16.                      Sleep( 5000 );
  17.                      // check queue for keyboard input
  18.                      wsprintf( szBuffer, "Queue Status - QS KEY - %x ",
  19.                               HIWORD( GetQueueStatus( QS_KEY ) ) );
  20.                      TextOut( hDC, 0, 20, szBuffer, lstrlen( szBuffer ) );
  21.                      // check queue for any mouse input
  22.                      wsprintf( szBuffer, "Queue Status - QS MOUSE - %x ",
  23.                               HIWORD( GetQueueStatus( QS_MOUSE ) ) );
  24.                      TextOut( hDC, 0, 40, szBuffer, lstrlen( szBuffer ) );
  25.                  }
  26.                  break;
  27.                  case IDM_EXIT:
  28.                      DestroyWindow( hWnd );
  29.                  break;
  30.              }
  31.              break;
  32.          case WM_DESTROY:
  33.                  PostQuitMessage( 0 );
  34.                  break;
  35.          default:
  36.              return ( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
  37.     }
  38.     return ( NULL );
  39. }